from django.conf.urls.defaults import patterns, include, url
from django.contrib import admin
from communicator.views import LatestQuestions
import settings

admin.autodiscover()

urlpatterns = patterns('',
    url(r'^$', 'communicator.views.get_main_page'),
    url(r'^/$', 'communicator.views.get_main_page'),
    url(r'^editor$', 'communicator.views.get_editor'),
    url(r'^rating$', 'communicator.views.get_rating_page'),
    url(r'^questions$', 'communicator.views.add_question'),
    url(r'^questions/(\d+)$', 'communicator.views.update_question'),
    url(r'^questions/voteup$', 'communicator.views.vote_up_question'),
    url(r'^questions/votedown$', 'communicator.views.vote_down_question'),
    url(r'^answers/(\d+)$', 'communicator.views.update_answer'),
    url(r'^answers/voteup$', 'communicator.views.vote_up_answer'),
    url(r'^answers/votedown$', 'communicator.views.vote_down_answer'),
    url(r'^addanswer$', 'communicator.views.add_answer'),
    url(r'^getanswers$', 'communicator.views.get_answers'),
    url(r'^search$', 'communicator.views.get_questions'),
    url(r'^question/(\d+)$', 'communicator.views.get_question'),
    url(r'^admin/', include(admin.site.urls)),
    url(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_ROOT}),
    url(r'^login$', 'communicator.views.login'),
    url(r'^logout$', 'communicator.views.logout'),
    url(r'^auth$', 'communicator.views.authenticate'),
    url(r'^feeds/latest/$', LatestQuestions()),
)

